# Copyright 2009 http://www.yuntien.com
# Licensed under the Apache License, Version 2.0

from google.appengine.api import memcache

COMMON_TIME_OUT = 3600

TAGS_KEY = 'DATA_TAGS'
RECENT_COMMENTS_KEY = 'DATA_RECENT_COMMENTS'

PAGE = 'PAGE' 

#cache decorator
def delete_cache(key):
  def decorator(method):
    def new_method(self, *args, **kwds):
      method(self, *args, **kwds)
      memcache.delete(key)            
    return new_method
  return decorator

#cache decorator
def delete_all_cache(method):
  def new_method(self, *args, **kwds):
    method(self, *args, **kwds)
    memcache.flush_all()     
  return new_method
